package main

/*
Implement strStr().
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
*/

import (
	"fmt"
	"strings"
)

func str(haystack string, needle string) int {
	return strings.Index(haystack, needle)
}

func str1(all string, sub string) int {
	for i := 0; ; i++ {
		for j := 0; ; j++ {
			if j == len(sub) {
				return i
			}
			if i+j == len(all) {
				return -1
			}
			if sub[j] != all[i+j] {
				break
			}
		}
	}
}

func main() {
	fmt.Println(str1("hello", "ll"))
}
